예제 #1
0
    def test_sample(self):
        players = PingResponse.Players({
            "max":
            20,
            "online":
            1,
            "sample": [{
                "name": 'Dinnerbone',
                'id': "61699b2e-d327-4a01-9f1e-0ea8c3f06bc6"
            }]
        })

        self.assertIsNotNone(players.sample)
        self.assertEqual(players.sample[0].name, "Dinnerbone")
예제 #2
0
    def test_sample(self):
        players = PingResponse.Players({
            "max":
            20,
            "online":
            1,
            "sample": [{
                "name": "Dinnerbone",
                "id": "61699b2e-d327-4a01-9f1e-0ea8c3f06bc6"
            }]
        })

        assert players.sample != None
        assert players.sample[0].name == "Dinnerbone"
예제 #3
0
 def test_sample_missing(self):
     players = PingResponse.Players({"max": 20, "online": 1})
     self.assertIsNone(players.sample)
예제 #4
0
    def test_valid(self):
        players = PingResponse.Players({"max": 20, "online": 5})

        self.assertEqual(players.max, 20)
        self.assertEqual(players.online, 5)
예제 #5
0
 def test_sample_missing(self):
     players = PingResponse.Players({"max": 20, "online": 1})
     assert players.sample == None
예제 #6
0
 def test_sample_invalid(self):
     with pytest.raises(ValueError):
         PingResponse.Players({"max": 20, "online": 1, "sample": "foo"})
예제 #7
0
    def test_valid(self):
        players = PingResponse.Players({"max": 20, "online": 5})

        assert players.max == 20
        assert players.online == 5
예제 #8
0
 def test_online_missing(self):
     with pytest.raises(ValueError):
         PingResponse.Players({"max": 20})
예제 #9
0
 def test_max_invalid(self):
     with pytest.raises(ValueError):
         PingResponse.Players({"max": "foo", "online": 5})
예제 #10
0
 def test_max_missing(self):
     with pytest.raises(ValueError):
         PingResponse.Players({"online": 5})
예제 #11
0
 def test_invalid(self):
     with pytest.raises(ValueError):
         PingResponse.Players("foo")