def test_fetch(self): """ Test that the security document is retrieved as expected """ sdoc = SecurityDocument(self.db) sdoc.fetch() self.assertDictEqual(sdoc, self.sdoc)
def test_fetch(self): """ Test that the security document is retrieved as expected """ sdoc = SecurityDocument(self.db) sdoc.fetch() self.assertDictEqual(sdoc, self.sdoc)
def test_json(self): """ Test the security document dictionary renders as a JSON string """ sdoc = SecurityDocument(self.db) sdoc.fetch() sdoc_as_json_string = sdoc.json() self.assertIsInstance(sdoc_as_json_string, str) sdoc_as_a_dict = json.loads(sdoc_as_json_string) self.assertDictEqual(sdoc_as_a_dict, sdoc)
def test_json(self): """ Test the security document dictionary renders as a JSON string """ sdoc = SecurityDocument(self.db) sdoc.fetch() sdoc_as_json_string = sdoc.json() self.assertIsInstance(sdoc_as_json_string, str) sdoc_as_a_dict = json.loads(sdoc_as_json_string) self.assertDictEqual(sdoc_as_a_dict, sdoc)
def test_context_manager(self): """ Test that the context SecurityDocument context manager enter and exit routines work as expected. """ with SecurityDocument(self.db) as sdoc: self.assertDictEqual(sdoc, self.sdoc) sdoc.update(self.mod_sdoc) mod_sdoc = SecurityDocument(self.db) mod_sdoc.fetch() self.assertDictEqual(mod_sdoc, self.mod_sdoc)
def test_save(self): """ Test that the security document is updated correctly """ sdoc = SecurityDocument(self.db) sdoc.fetch() sdoc.update(self.mod_sdoc) sdoc.save() mod_sdoc = SecurityDocument(self.db) mod_sdoc.fetch() self.assertDictEqual(mod_sdoc, self.mod_sdoc)
def test_save(self): """ Test that the security document is updated correctly """ sdoc = SecurityDocument(self.db) sdoc.fetch() sdoc.update(self.mod_sdoc) sdoc.save() mod_sdoc = SecurityDocument(self.db) mod_sdoc.fetch() self.assertDictEqual(mod_sdoc, self.mod_sdoc)
def test_context_manager(self): """ Test that the context SecurityDocument context manager enter and exit routines work as expected. """ with SecurityDocument(self.db) as sdoc: self.assertDictEqual(sdoc, self.sdoc) sdoc.update(self.mod_sdoc) mod_sdoc = SecurityDocument(self.db) mod_sdoc.fetch() self.assertDictEqual(mod_sdoc, self.mod_sdoc)