Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_feeds_write(prevent_modification):
copyfile(my_dir + "/datafiles/feeds_working", feeds.Feeds.PATH)
myfeeds = feeds.Feeds()
myfeed_path = my_dir + "/feeds/valid_basic.xml"
myfeed = Feed(file=myfeed_path)
myfeeds[myfeed_path] = myfeed
myfeeds.write()
myfeeds2 = feeds.Feeds()
assert myfeed_path in myfeeds2
def test_feeds_del_item(prevent_modification):
copyfile(my_dir + "/datafiles/feeds_working", feeds.Feeds.PATH)
myfeeds = feeds.Feeds()
del myfeeds["feed key"]
assert "seek_distance" not in myfeeds
def test_feeds_at_1(prevent_modification):
copyfile(my_dir + "/datafiles/feeds_working", feeds.Feeds.PATH)
myfeeds = feeds.Feeds()
assert myfeeds.at(1).title == "feed2 title"
def test_feeds_at_0(prevent_modification):
copyfile(my_dir + "/datafiles/feeds_working", feeds.Feeds.PATH)
myfeeds = feeds.Feeds()
assert myfeeds.at(0).title == "feed title"
def test_feeds_default(prevent_modification):
myfeeds = feeds.Feeds()
assert isinstance(myfeeds, feeds.Feeds)
def test_feeds_reload(prevent_modification, display):
os.chdir(my_dir)
copyfile(my_dir + "/datafiles/feeds_working2", feeds.Feeds.PATH)
myfeeds = feeds.Feeds()
myfeeds2 = copy.copy(myfeeds)
display.change_status = mock.MagicMock(name="change_status")
myfeeds2.reload(display)
assert display.change_status.call_count == 2
for feed in myfeeds:
assert feed in myfeeds2
def test_feeds_set_item(prevent_modification):
myfeeds = feeds.Feeds()
myfeeds["fake"] = "value"
assert "fake" in myfeeds
def test_feeds_del_at_1(prevent_modification):
copyfile(my_dir + "/datafiles/feeds_working", feeds.Feeds.PATH)
myfeeds = feeds.Feeds()
deleted = myfeeds.del_at(1)
assert deleted
assert "http://feed2_url" not in myfeeds
def test_feeds_write(prevent_modification):
copyfile(my_dir + "/datafiles/feeds_working", feeds.Feeds.PATH)
myfeeds = feeds.Feeds()
myfeed_path = my_dir + "/feeds/valid_basic.xml"
myfeed = Feed(file=myfeed_path)
myfeeds[myfeed_path] = myfeed
myfeeds.write()
myfeeds2 = feeds.Feeds()
assert myfeed_path in myfeeds2