def test_ownership(self): self.assertItemsEqual([self.data_item.get_id], FixtureDataItem.by_user(self.user, wrap=False)) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False)) fixture, = fixturegenerators.item_lists(self.user) check_xml_line_by_line( self, """ <fixture id="item-list:contact" user_id="%s"> <contact_list> <contact> <name>John</name> <number>+15555555555</number> </contact> </contact_list> </fixture> """ % self.user.user_id, ElementTree.tostring(fixture)) self.data_item.remove_user(self.user) self.assertItemsEqual([], self.data_item.get_all_users()) self.fixture_ownership = self.data_item.add_user(self.user) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False))
def test_ownership(self): self.assertItemsEqual([self.data_item.get_id], FixtureDataItem.by_user(self.user, wrap=False)) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False)) fixture, = fixturegenerators.item_lists( self.user.to_ota_restore_user(), V2) check_xml_line_by_line( self, """ <fixture id="item-list:district" user_id="%s"> <district_list> <district> <state_name>Delhi_state</state_name> <district_name lang="hin">Delhi_in_HIN</district_name> <district_name lang="eng">Delhi_in_ENG</district_name> <district_id>Delhi_id</district_id> </district> </district_list> </fixture> """ % self.user.user_id, ElementTree.tostring(fixture)) self.data_item.remove_user(self.user) self.assertItemsEqual([], self.data_item.get_all_users()) self.fixture_ownership = self.data_item.add_user(self.user) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False))
def test_fixture_removal(self): """ An empty fixture list should be generated for each fixture that the use does not have access to (within the domain). """ self.data_item.remove_user(self.user) fixtures = fixturegenerators.item_lists( self.user.to_ota_restore_user(), V2) self.assertEqual(1, len(fixtures)) check_xml_line_by_line( self, """ <fixture id="item-list:district" user_id="{}"> <district_list /> </fixture> """.format(self.user.user_id), ElementTree.tostring(fixtures[0])) self.fixture_ownership = self.data_item.add_user(self.user)
def test_fixture_removal(self): """ An empty fixture list should be generated for each fixture that the use does not have access to (within the domain). """ self.data_item.remove_user(self.user) fixtures = fixturegenerators.item_lists(self.user.to_ota_restore_user(), V2) self.assertEqual(1, len(fixtures)) check_xml_line_by_line( self, """ <fixture id="item-list:district" user_id="{}"> <district_list /> </fixture> """.format(self.user.user_id), ElementTree.tostring(fixtures[0]) ) self.fixture_ownership = self.data_item.add_user(self.user)
def test_ownership(self): self.assertItemsEqual([self.data_item.get_id], FixtureDataItem.by_user(self.user, wrap=False)) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False)) fixture, = fixturegenerators.item_lists(self.user, version=V2, last_sync=None) check_xml_line_by_line(self, """ <fixture id="item-list:contact" user_id="%s"> <contact_list> <contact> <name>John</name> <number>+15555555555</number> </contact> </contact_list> </fixture> """ % self.user.user_id, ElementTree.tostring(fixture)) self.data_item.remove_user(self.user) self.assertItemsEqual([], self.data_item.get_all_users()) self.fixture_ownership = self.data_item.add_user(self.user) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False))
def test_ownership(self): self.assertItemsEqual([self.data_item.get_id], FixtureDataItem.by_user(self.user, wrap=False)) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False)) fixture, = fixturegenerators.item_lists(self.user, V2) check_xml_line_by_line(self, """ <fixture id="item-list:district" user_id="%s"> <district_list> <district> <state_name>Delhi_state</state_name> <district_name lang="hin">Delhi_in_HIN</district_name> <district_name lang="eng">Delhi_in_ENG</district_name> <district_id>Delhi_id</district_id> </district> </district_list> </fixture> """ % self.user.user_id, ElementTree.tostring(fixture)) self.data_item.remove_user(self.user) self.assertItemsEqual([], self.data_item.get_all_users()) self.fixture_ownership = self.data_item.add_user(self.user) self.assertItemsEqual([self.user.get_id], self.data_item.get_all_users(wrap=False))