示例#1
0
 def test_report_root_enabled(self):
     mock_db_api = mock()
     when(trove.extensions.mysql.models).get_db_api().thenReturn(mock_db_api)
     when(mock_db_api).find_by(any(), id=None).thenReturn(None)
     root_history = RootHistory("x", "root")
     when(mock_db_api).save(any(RootHistory)).thenReturn(root_history)
     # invocation
     history = MySqlRootAccess.report_root_enabled(TroveContext())
     # verification
     self.assertThat(history, Is(root_history))
     verify(mock_db_api).save(any(RootHistory))
示例#2
0
 def test_report_root_enabled(self):
     mock_db_api = mock()
     when(
         trove.extensions.mysql.models).get_db_api().thenReturn(mock_db_api)
     when(mock_db_api).find_by(any(), id=None).thenReturn(None)
     root_history = RootHistory('x', 'root')
     when(mock_db_api).save(any(RootHistory)).thenReturn(root_history)
     # invocation
     history = MySqlRootAccess.report_root_enabled(TroveContext())
     # verification
     self.assertThat(history, Is(root_history))
     verify(mock_db_api).save(any(RootHistory))