Exemple #1
0
 def test_checkdupes_with_dup(self):
     # GIVEN
     p1 = FakeClient(self.console, name="sameName", guid="p1guid")
     p1.warn = Mock()
     p1.connects("1")
     p2 = FakeClient(self.console, name="sameName", guid="p2guid")
     p2.warn = Mock()
     p2.connects("2")
     # WHEN
     self.assertTrue(p1.name == p2.name)
     self.p.namecheck()
     # THEN
     p1.warn.assert_has_calls([call(ANY, ANY, 'badname', None, '')])
     p2.warn.assert_has_calls([call(ANY, ANY, 'badname', None, '')])
Exemple #2
0
 def test_checkdupes_no_dup(self):
     # GIVEN
     p1 = FakeClient(self.console, name="theName", guid="p1guid")
     p1.warn = Mock()
     p1.connects("1")
     p2 = FakeClient(self.console, name="anotherName", guid="p2guid")
     p2.warn = Mock()
     p2.connects("2")
     # WHEN
     self.assertFalse(p1.name == p2.name)
     self.p.namecheck()
     # THEN
     self.assertFalse(p1.warn.called)
     self.assertFalse(p2.warn.called)
Exemple #3
0
 def test_checkbadnames(self):
     # GIVEN
     p1 = FakeClient(self.console, name="all", guid="p1guid")
     p1.warn = Mock()
     p1.connects("1")
     # WHEN
     self.p.namecheck()
     # THEN
     p1.warn.assert_has_calls([call(ANY, ANY, 'badname', None, '')])
Exemple #4
0
 def test_checkdupes_with_player_reconnecting(self):
     # GIVEN
     p1 = FakeClient(self.console, name="sameName", guid="p1guid")
     p1.warn = Mock()
     p1.connects("1")
     # WHEN
     p1.disconnects()
     p1.connects("2")
     self.p.namecheck()
     # THEN
     self.assertFalse(p1.warn.called)