| @@ 188-263 (lines=76) @@ | ||
| 185 | self.assertEqual(response.status_code, 302) |
|
| 186 | ||
| 187 | ||
| 188 | class LocationViewTest(unittest.TestCase): |
|
| 189 | ''' |
|
| 190 | Tests for Location |
|
| 191 | ''' |
|
| 192 | def setUp(self): |
|
| 193 | self.client = Client() |
|
| 194 | ||
| 195 | def test_list_location(self): |
|
| 196 | url = reverse('kamailio_location_list') |
|
| 197 | response = self.client.get(url) |
|
| 198 | self.assertEqual(response.status_code, 200) |
|
| 199 | ||
| 200 | def test_create_location(self): |
|
| 201 | url = reverse('kamailio_location_create') |
|
| 202 | data = { |
|
| 203 | "ruid": "ruid", |
|
| 204 | "username": "username", |
|
| 205 | "domain": "domain", |
|
| 206 | "contact": "contact", |
|
| 207 | "received": "received", |
|
| 208 | "path": "path", |
|
| 209 | "expires": "expires", |
|
| 210 | "q": "q", |
|
| 211 | "callid": "callid", |
|
| 212 | "cseq": "cseq", |
|
| 213 | "last_modified": "last_modified", |
|
| 214 | "flags": "flags", |
|
| 215 | "cflags": "cflags", |
|
| 216 | "user_agent": "user_agent", |
|
| 217 | "socket": "socket", |
|
| 218 | "methods": "methods", |
|
| 219 | "instance": "instance", |
|
| 220 | "reg_id": "reg_id", |
|
| 221 | "server_id": "server_id", |
|
| 222 | "connection_id": "connection_id", |
|
| 223 | "keepalive": "keepalive", |
|
| 224 | "partition": "partition", |
|
| 225 | } |
|
| 226 | response = self.client.post(url, data=data) |
|
| 227 | self.assertEqual(response.status_code, 302) |
|
| 228 | ||
| 229 | def test_detail_location(self): |
|
| 230 | location = create_location() |
|
| 231 | url = reverse('kamailio_location_detail', args=[location.pk,]) |
|
| 232 | response = self.client.get(url) |
|
| 233 | self.assertEqual(response.status_code, 200) |
|
| 234 | ||
| 235 | def test_update_location(self): |
|
| 236 | location = create_location() |
|
| 237 | data = { |
|
| 238 | "ruid": "ruid", |
|
| 239 | "username": "username", |
|
| 240 | "domain": "domain", |
|
| 241 | "contact": "contact", |
|
| 242 | "received": "received", |
|
| 243 | "path": "path", |
|
| 244 | "expires": "expires", |
|
| 245 | "q": "q", |
|
| 246 | "callid": "callid", |
|
| 247 | "cseq": "cseq", |
|
| 248 | "last_modified": "last_modified", |
|
| 249 | "flags": "flags", |
|
| 250 | "cflags": "cflags", |
|
| 251 | "user_agent": "user_agent", |
|
| 252 | "socket": "socket", |
|
| 253 | "methods": "methods", |
|
| 254 | "instance": "instance", |
|
| 255 | "reg_id": "reg_id", |
|
| 256 | "server_id": "server_id", |
|
| 257 | "connection_id": "connection_id", |
|
| 258 | "keepalive": "keepalive", |
|
| 259 | "partition": "partition", |
|
| 260 | } |
|
| 261 | url = reverse('kamailio_location_update', args=[location.pk,]) |
|
| 262 | response = self.client.post(url, data) |
|
| 263 | self.assertEqual(response.status_code, 302) |
|
| 264 | ||
| 265 | ||
| 266 | class LocationAttrsViewTest(unittest.TestCase): |
|
| @@ 396-443 (lines=48) @@ | ||
| 393 | self.assertEqual(response.status_code, 302) |
|
| 394 | ||
| 395 | ||
| 396 | class SpeedDialViewTest(unittest.TestCase): |
|
| 397 | ''' |
|
| 398 | Tests for SpeedDial |
|
| 399 | ''' |
|
| 400 | def setUp(self): |
|
| 401 | self.client = Client() |
|
| 402 | ||
| 403 | def test_list_speeddial(self): |
|
| 404 | url = reverse('kamailio_speeddial_list') |
|
| 405 | response = self.client.get(url) |
|
| 406 | self.assertEqual(response.status_code, 200) |
|
| 407 | ||
| 408 | def test_create_speeddial(self): |
|
| 409 | url = reverse('kamailio_speeddial_create') |
|
| 410 | data = { |
|
| 411 | "username": "username", |
|
| 412 | "domain": "domain", |
|
| 413 | "sd_username": "sd_username", |
|
| 414 | "sd_domain": "sd_domain", |
|
| 415 | "new_uri": "new_uri", |
|
| 416 | "fname": "fname", |
|
| 417 | "lname": "lname", |
|
| 418 | "description": "description", |
|
| 419 | } |
|
| 420 | response = self.client.post(url, data=data) |
|
| 421 | self.assertEqual(response.status_code, 302) |
|
| 422 | ||
| 423 | def test_detail_speeddial(self): |
|
| 424 | speeddial = create_speeddial() |
|
| 425 | url = reverse('kamailio_speeddial_detail', args=[speeddial.pk,]) |
|
| 426 | response = self.client.get(url) |
|
| 427 | self.assertEqual(response.status_code, 200) |
|
| 428 | ||
| 429 | def test_update_speeddial(self): |
|
| 430 | speeddial = create_speeddial() |
|
| 431 | data = { |
|
| 432 | "username": "username", |
|
| 433 | "domain": "domain", |
|
| 434 | "sd_username": "sd_username", |
|
| 435 | "sd_domain": "sd_domain", |
|
| 436 | "new_uri": "new_uri", |
|
| 437 | "fname": "fname", |
|
| 438 | "lname": "lname", |
|
| 439 | "description": "description", |
|
| 440 | } |
|
| 441 | url = reverse('kamailio_speeddial_update', args=[speeddial.pk,]) |
|
| 442 | response = self.client.post(url, data) |
|
| 443 | self.assertEqual(response.status_code, 302) |
|
| 444 | ||
| 445 | ||
| 446 | class PipeLimitViewTest(unittest.TestCase): |
|
| @@ 266-311 (lines=46) @@ | ||
| 263 | self.assertEqual(response.status_code, 302) |
|
| 264 | ||
| 265 | ||
| 266 | class LocationAttrsViewTest(unittest.TestCase): |
|
| 267 | ''' |
|
| 268 | Tests for LocationAttrs |
|
| 269 | ''' |
|
| 270 | def setUp(self): |
|
| 271 | self.client = Client() |
|
| 272 | ||
| 273 | def test_list_locationattrs(self): |
|
| 274 | url = reverse('kamailio_locationattrs_list') |
|
| 275 | response = self.client.get(url) |
|
| 276 | self.assertEqual(response.status_code, 200) |
|
| 277 | ||
| 278 | def test_create_locationattrs(self): |
|
| 279 | url = reverse('kamailio_locationattrs_create') |
|
| 280 | data = { |
|
| 281 | "ruid": "ruid", |
|
| 282 | "username": "username", |
|
| 283 | "domain": "domain", |
|
| 284 | "aname": "aname", |
|
| 285 | "atype": "atype", |
|
| 286 | "avalue": "avalue", |
|
| 287 | "last_modified": "last_modified", |
|
| 288 | } |
|
| 289 | response = self.client.post(url, data=data) |
|
| 290 | self.assertEqual(response.status_code, 302) |
|
| 291 | ||
| 292 | def test_detail_locationattrs(self): |
|
| 293 | locationattrs = create_locationattrs() |
|
| 294 | url = reverse('kamailio_locationattrs_detail', args=[locationattrs.pk,]) |
|
| 295 | response = self.client.get(url) |
|
| 296 | self.assertEqual(response.status_code, 200) |
|
| 297 | ||
| 298 | def test_update_locationattrs(self): |
|
| 299 | locationattrs = create_locationattrs() |
|
| 300 | data = { |
|
| 301 | "ruid": "ruid", |
|
| 302 | "username": "username", |
|
| 303 | "domain": "domain", |
|
| 304 | "aname": "aname", |
|
| 305 | "atype": "atype", |
|
| 306 | "avalue": "avalue", |
|
| 307 | "last_modified": "last_modified", |
|
| 308 | } |
|
| 309 | url = reverse('kamailio_locationattrs_update', args=[locationattrs.pk,]) |
|
| 310 | response = self.client.post(url, data) |
|
| 311 | self.assertEqual(response.status_code, 302) |
|
| 312 | ||
| 313 | ||
| 314 | class UserBlackListViewTest(unittest.TestCase): |
|
| @@ 564-605 (lines=42) @@ | ||
| 561 | self.assertEqual(response.status_code, 302) |
|
| 562 | ||
| 563 | ||
| 564 | class HtableViewTest(unittest.TestCase): |
|
| 565 | ''' |
|
| 566 | Tests for Htable |
|
| 567 | ''' |
|
| 568 | def setUp(self): |
|
| 569 | self.client = Client() |
|
| 570 | ||
| 571 | def test_list_htable(self): |
|
| 572 | url = reverse('kamailio_htable_list') |
|
| 573 | response = self.client.get(url) |
|
| 574 | self.assertEqual(response.status_code, 200) |
|
| 575 | ||
| 576 | def test_create_htable(self): |
|
| 577 | url = reverse('kamailio_htable_create') |
|
| 578 | data = { |
|
| 579 | "key_name": "key_name", |
|
| 580 | "key_type": "key_type", |
|
| 581 | "value_type": "value_type", |
|
| 582 | "key_value": "key_value", |
|
| 583 | "expires": "expires", |
|
| 584 | } |
|
| 585 | response = self.client.post(url, data=data) |
|
| 586 | self.assertEqual(response.status_code, 302) |
|
| 587 | ||
| 588 | def test_detail_htable(self): |
|
| 589 | htable = create_htable() |
|
| 590 | url = reverse('kamailio_htable_detail', args=[htable.pk,]) |
|
| 591 | response = self.client.get(url) |
|
| 592 | self.assertEqual(response.status_code, 200) |
|
| 593 | ||
| 594 | def test_update_htable(self): |
|
| 595 | htable = create_htable() |
|
| 596 | data = { |
|
| 597 | "key_name": "key_name", |
|
| 598 | "key_type": "key_type", |
|
| 599 | "value_type": "value_type", |
|
| 600 | "key_value": "key_value", |
|
| 601 | "expires": "expires", |
|
| 602 | } |
|
| 603 | url = reverse('kamailio_htable_update', args=[htable.pk,]) |
|
| 604 | response = self.client.post(url, data) |
|
| 605 | self.assertEqual(response.status_code, 302) |
|
| 606 | ||
| @@ 314-353 (lines=40) @@ | ||
| 311 | self.assertEqual(response.status_code, 302) |
|
| 312 | ||
| 313 | ||
| 314 | class UserBlackListViewTest(unittest.TestCase): |
|
| 315 | ''' |
|
| 316 | Tests for UserBlackList |
|
| 317 | ''' |
|
| 318 | def setUp(self): |
|
| 319 | self.client = Client() |
|
| 320 | ||
| 321 | def test_list_userblacklist(self): |
|
| 322 | url = reverse('kamailio_userblacklist_list') |
|
| 323 | response = self.client.get(url) |
|
| 324 | self.assertEqual(response.status_code, 200) |
|
| 325 | ||
| 326 | def test_create_userblacklist(self): |
|
| 327 | url = reverse('kamailio_userblacklist_create') |
|
| 328 | data = { |
|
| 329 | "username": "username", |
|
| 330 | "domain": "domain", |
|
| 331 | "prefix": "prefix", |
|
| 332 | "whitelist": "whitelist", |
|
| 333 | } |
|
| 334 | response = self.client.post(url, data=data) |
|
| 335 | self.assertEqual(response.status_code, 302) |
|
| 336 | ||
| 337 | def test_detail_userblacklist(self): |
|
| 338 | userblacklist = create_userblacklist() |
|
| 339 | url = reverse('kamailio_userblacklist_detail', args=[userblacklist.pk,]) |
|
| 340 | response = self.client.get(url) |
|
| 341 | self.assertEqual(response.status_code, 200) |
|
| 342 | ||
| 343 | def test_update_userblacklist(self): |
|
| 344 | userblacklist = create_userblacklist() |
|
| 345 | data = { |
|
| 346 | "username": "username", |
|
| 347 | "domain": "domain", |
|
| 348 | "prefix": "prefix", |
|
| 349 | "whitelist": "whitelist", |
|
| 350 | } |
|
| 351 | url = reverse('kamailio_userblacklist_update', args=[userblacklist.pk,]) |
|
| 352 | response = self.client.post(url, data) |
|
| 353 | self.assertEqual(response.status_code, 302) |
|
| 354 | ||
| 355 | ||
| 356 | class GlobalBlackListViewTest(unittest.TestCase): |
|
| @@ 524-561 (lines=38) @@ | ||
| 521 | self.assertEqual(response.status_code, 302) |
|
| 522 | ||
| 523 | ||
| 524 | class MtreesViewTest(unittest.TestCase): |
|
| 525 | ''' |
|
| 526 | Tests for Mtrees |
|
| 527 | ''' |
|
| 528 | def setUp(self): |
|
| 529 | self.client = Client() |
|
| 530 | ||
| 531 | def test_list_mtrees(self): |
|
| 532 | url = reverse('kamailio_mtrees_list') |
|
| 533 | response = self.client.get(url) |
|
| 534 | self.assertEqual(response.status_code, 200) |
|
| 535 | ||
| 536 | def test_create_mtrees(self): |
|
| 537 | url = reverse('kamailio_mtrees_create') |
|
| 538 | data = { |
|
| 539 | "tname": "tname", |
|
| 540 | "tprefix": "tprefix", |
|
| 541 | "tvalue": "tvalue", |
|
| 542 | } |
|
| 543 | response = self.client.post(url, data=data) |
|
| 544 | self.assertEqual(response.status_code, 302) |
|
| 545 | ||
| 546 | def test_detail_mtrees(self): |
|
| 547 | mtrees = create_mtrees() |
|
| 548 | url = reverse('kamailio_mtrees_detail', args=[mtrees.pk,]) |
|
| 549 | response = self.client.get(url) |
|
| 550 | self.assertEqual(response.status_code, 200) |
|
| 551 | ||
| 552 | def test_update_mtrees(self): |
|
| 553 | mtrees = create_mtrees() |
|
| 554 | data = { |
|
| 555 | "tname": "tname", |
|
| 556 | "tprefix": "tprefix", |
|
| 557 | "tvalue": "tvalue", |
|
| 558 | } |
|
| 559 | url = reverse('kamailio_mtrees_update', args=[mtrees.pk,]) |
|
| 560 | response = self.client.post(url, data) |
|
| 561 | self.assertEqual(response.status_code, 302) |
|
| 562 | ||
| 563 | ||
| 564 | class HtableViewTest(unittest.TestCase): |
|
| @@ 446-483 (lines=38) @@ | ||
| 443 | self.assertEqual(response.status_code, 302) |
|
| 444 | ||
| 445 | ||
| 446 | class PipeLimitViewTest(unittest.TestCase): |
|
| 447 | ''' |
|
| 448 | Tests for PipeLimit |
|
| 449 | ''' |
|
| 450 | def setUp(self): |
|
| 451 | self.client = Client() |
|
| 452 | ||
| 453 | def test_list_pipelimit(self): |
|
| 454 | url = reverse('kamailio_pipelimit_list') |
|
| 455 | response = self.client.get(url) |
|
| 456 | self.assertEqual(response.status_code, 200) |
|
| 457 | ||
| 458 | def test_create_pipelimit(self): |
|
| 459 | url = reverse('kamailio_pipelimit_create') |
|
| 460 | data = { |
|
| 461 | "pipeid": "pipeid", |
|
| 462 | "algorithm": "algorithm", |
|
| 463 | "plimit": "plimit", |
|
| 464 | } |
|
| 465 | response = self.client.post(url, data=data) |
|
| 466 | self.assertEqual(response.status_code, 302) |
|
| 467 | ||
| 468 | def test_detail_pipelimit(self): |
|
| 469 | pipelimit = create_pipelimit() |
|
| 470 | url = reverse('kamailio_pipelimit_detail', args=[pipelimit.pk,]) |
|
| 471 | response = self.client.get(url) |
|
| 472 | self.assertEqual(response.status_code, 200) |
|
| 473 | ||
| 474 | def test_update_pipelimit(self): |
|
| 475 | pipelimit = create_pipelimit() |
|
| 476 | data = { |
|
| 477 | "pipeid": "pipeid", |
|
| 478 | "algorithm": "algorithm", |
|
| 479 | "plimit": "plimit", |
|
| 480 | } |
|
| 481 | url = reverse('kamailio_pipelimit_update', args=[pipelimit.pk,]) |
|
| 482 | response = self.client.post(url, data) |
|
| 483 | self.assertEqual(response.status_code, 302) |
|
| 484 | ||
| 485 | ||
| 486 | class MtreeViewTest(unittest.TestCase): |
|
| @@ 356-393 (lines=38) @@ | ||
| 353 | self.assertEqual(response.status_code, 302) |
|
| 354 | ||
| 355 | ||
| 356 | class GlobalBlackListViewTest(unittest.TestCase): |
|
| 357 | ''' |
|
| 358 | Tests for GlobalBlackList |
|
| 359 | ''' |
|
| 360 | def setUp(self): |
|
| 361 | self.client = Client() |
|
| 362 | ||
| 363 | def test_list_globalblacklist(self): |
|
| 364 | url = reverse('kamailio_globalblacklist_list') |
|
| 365 | response = self.client.get(url) |
|
| 366 | self.assertEqual(response.status_code, 200) |
|
| 367 | ||
| 368 | def test_create_globalblacklist(self): |
|
| 369 | url = reverse('kamailio_globalblacklist_create') |
|
| 370 | data = { |
|
| 371 | "prefix": "prefix", |
|
| 372 | "whitelist": "whitelist", |
|
| 373 | "description": "description", |
|
| 374 | } |
|
| 375 | response = self.client.post(url, data=data) |
|
| 376 | self.assertEqual(response.status_code, 302) |
|
| 377 | ||
| 378 | def test_detail_globalblacklist(self): |
|
| 379 | globalblacklist = create_globalblacklist() |
|
| 380 | url = reverse('kamailio_globalblacklist_detail', args=[globalblacklist.pk,]) |
|
| 381 | response = self.client.get(url) |
|
| 382 | self.assertEqual(response.status_code, 200) |
|
| 383 | ||
| 384 | def test_update_globalblacklist(self): |
|
| 385 | globalblacklist = create_globalblacklist() |
|
| 386 | data = { |
|
| 387 | "prefix": "prefix", |
|
| 388 | "whitelist": "whitelist", |
|
| 389 | "description": "description", |
|
| 390 | } |
|
| 391 | url = reverse('kamailio_globalblacklist_update', args=[globalblacklist.pk,]) |
|
| 392 | response = self.client.post(url, data) |
|
| 393 | self.assertEqual(response.status_code, 302) |
|
| 394 | ||
| 395 | ||
| 396 | class SpeedDialViewTest(unittest.TestCase): |
|
| @@ 486-521 (lines=36) @@ | ||
| 483 | self.assertEqual(response.status_code, 302) |
|
| 484 | ||
| 485 | ||
| 486 | class MtreeViewTest(unittest.TestCase): |
|
| 487 | ''' |
|
| 488 | Tests for Mtree |
|
| 489 | ''' |
|
| 490 | def setUp(self): |
|
| 491 | self.client = Client() |
|
| 492 | ||
| 493 | def test_list_mtree(self): |
|
| 494 | url = reverse('kamailio_mtree_list') |
|
| 495 | response = self.client.get(url) |
|
| 496 | self.assertEqual(response.status_code, 200) |
|
| 497 | ||
| 498 | def test_create_mtree(self): |
|
| 499 | url = reverse('kamailio_mtree_create') |
|
| 500 | data = { |
|
| 501 | "tprefix": "tprefix", |
|
| 502 | "tvalue": "tvalue", |
|
| 503 | } |
|
| 504 | response = self.client.post(url, data=data) |
|
| 505 | self.assertEqual(response.status_code, 302) |
|
| 506 | ||
| 507 | def test_detail_mtree(self): |
|
| 508 | mtree = create_mtree() |
|
| 509 | url = reverse('kamailio_mtree_detail', args=[mtree.pk,]) |
|
| 510 | response = self.client.get(url) |
|
| 511 | self.assertEqual(response.status_code, 200) |
|
| 512 | ||
| 513 | def test_update_mtree(self): |
|
| 514 | mtree = create_mtree() |
|
| 515 | data = { |
|
| 516 | "tprefix": "tprefix", |
|
| 517 | "tvalue": "tvalue", |
|
| 518 | } |
|
| 519 | url = reverse('kamailio_mtree_update', args=[mtree.pk,]) |
|
| 520 | response = self.client.post(url, data) |
|
| 521 | self.assertEqual(response.status_code, 302) |
|
| 522 | ||
| 523 | ||
| 524 | class MtreesViewTest(unittest.TestCase): |
|
| @@ 150-185 (lines=36) @@ | ||
| 147 | return Htable.objects.create(**defaults) |
|
| 148 | ||
| 149 | ||
| 150 | class VersionViewTest(unittest.TestCase): |
|
| 151 | ''' |
|
| 152 | Tests for Version |
|
| 153 | ''' |
|
| 154 | def setUp(self): |
|
| 155 | self.client = Client() |
|
| 156 | ||
| 157 | def test_list_version(self): |
|
| 158 | url = reverse('kamailio_version_list') |
|
| 159 | response = self.client.get(url) |
|
| 160 | self.assertEqual(response.status_code, 200) |
|
| 161 | ||
| 162 | def test_create_version(self): |
|
| 163 | url = reverse('kamailio_version_create') |
|
| 164 | data = { |
|
| 165 | "table_name": "table_name", |
|
| 166 | "table_version": "table_version", |
|
| 167 | } |
|
| 168 | response = self.client.post(url, data=data) |
|
| 169 | self.assertEqual(response.status_code, 302) |
|
| 170 | ||
| 171 | def test_detail_version(self): |
|
| 172 | version = create_version() |
|
| 173 | url = reverse('kamailio_version_detail', args=[version.pk,]) |
|
| 174 | response = self.client.get(url) |
|
| 175 | self.assertEqual(response.status_code, 200) |
|
| 176 | ||
| 177 | def test_update_version(self): |
|
| 178 | version = create_version() |
|
| 179 | data = { |
|
| 180 | "table_name": "table_name", |
|
| 181 | "table_version": "table_version", |
|
| 182 | } |
|
| 183 | url = reverse('kamailio_version_update', args=[version.pk,]) |
|
| 184 | response = self.client.post(url, data) |
|
| 185 | self.assertEqual(response.status_code, 302) |
|
| 186 | ||
| 187 | ||
| 188 | class LocationViewTest(unittest.TestCase): |
|
| @@ 70-147 (lines=78) @@ | ||
| 67 | return DialogVar.objects.create(**defaults) |
|
| 68 | ||
| 69 | ||
| 70 | class DialogViewTest(unittest.TestCase): |
|
| 71 | ''' |
|
| 72 | Tests for Dialog |
|
| 73 | ''' |
|
| 74 | def setUp(self): |
|
| 75 | self.client = Client() |
|
| 76 | ||
| 77 | def test_list_dialog(self): |
|
| 78 | url = reverse('sipdialog_dialog_list') |
|
| 79 | response = self.client.get(url) |
|
| 80 | self.assertEqual(response.status_code, 200) |
|
| 81 | ||
| 82 | def test_create_dialog(self): |
|
| 83 | url = reverse('sipdialog_dialog_create') |
|
| 84 | data = { |
|
| 85 | "hash_entry": "hash_entry", |
|
| 86 | "hash_id": "hash_id", |
|
| 87 | "callid": "callid", |
|
| 88 | "from_uri": "from_uri", |
|
| 89 | "from_tag": "from_tag", |
|
| 90 | "to_uri": "to_uri", |
|
| 91 | "to_tag": "to_tag", |
|
| 92 | "caller_cseq": "caller_cseq", |
|
| 93 | "callee_cseq": "callee_cseq", |
|
| 94 | "caller_route_set": "caller_route_set", |
|
| 95 | "callee_route_set": "callee_route_set", |
|
| 96 | "caller_contact": "caller_contact", |
|
| 97 | "callee_contact": "callee_contact", |
|
| 98 | "caller_sock": "caller_sock", |
|
| 99 | "callee_stock": "callee_stock", |
|
| 100 | "state": "state", |
|
| 101 | "start_time": "start_time", |
|
| 102 | "timeout": "timeout", |
|
| 103 | "sflags": "sflags", |
|
| 104 | "iflags": "iflags", |
|
| 105 | "toroute_name": "toroute_name", |
|
| 106 | "req_uri": "req_uri", |
|
| 107 | "xdata": "xdata", |
|
| 108 | } |
|
| 109 | response = self.client.post(url, data=data) |
|
| 110 | self.assertEqual(response.status_code, 302) |
|
| 111 | ||
| 112 | def test_detail_dialog(self): |
|
| 113 | dialog = create_dialog() |
|
| 114 | url = reverse('sipdialog_dialog_detail', args=[dialog.pk,]) |
|
| 115 | response = self.client.get(url) |
|
| 116 | self.assertEqual(response.status_code, 200) |
|
| 117 | ||
| 118 | def test_update_dialog(self): |
|
| 119 | dialog = create_dialog() |
|
| 120 | data = { |
|
| 121 | "hash_entry": "hash_entry", |
|
| 122 | "hash_id": "hash_id", |
|
| 123 | "callid": "callid", |
|
| 124 | "from_uri": "from_uri", |
|
| 125 | "from_tag": "from_tag", |
|
| 126 | "to_uri": "to_uri", |
|
| 127 | "to_tag": "to_tag", |
|
| 128 | "caller_cseq": "caller_cseq", |
|
| 129 | "callee_cseq": "callee_cseq", |
|
| 130 | "caller_route_set": "caller_route_set", |
|
| 131 | "callee_route_set": "callee_route_set", |
|
| 132 | "caller_contact": "caller_contact", |
|
| 133 | "callee_contact": "callee_contact", |
|
| 134 | "caller_sock": "caller_sock", |
|
| 135 | "callee_stock": "callee_stock", |
|
| 136 | "state": "state", |
|
| 137 | "start_time": "start_time", |
|
| 138 | "timeout": "timeout", |
|
| 139 | "sflags": "sflags", |
|
| 140 | "iflags": "iflags", |
|
| 141 | "toroute_name": "toroute_name", |
|
| 142 | "req_uri": "req_uri", |
|
| 143 | "xdata": "xdata", |
|
| 144 | } |
|
| 145 | url = reverse('sipdialog_dialog_update', args=[dialog.pk,]) |
|
| 146 | response = self.client.post(url, data) |
|
| 147 | self.assertEqual(response.status_code, 302) |
|
| 148 | ||
| 149 | ||
| 150 | class DialogVarViewTest(unittest.TestCase): |
|
| @@ 150-189 (lines=40) @@ | ||
| 147 | self.assertEqual(response.status_code, 302) |
|
| 148 | ||
| 149 | ||
| 150 | class DialogVarViewTest(unittest.TestCase): |
|
| 151 | ''' |
|
| 152 | Tests for DialogVar |
|
| 153 | ''' |
|
| 154 | def setUp(self): |
|
| 155 | self.client = Client() |
|
| 156 | ||
| 157 | def test_list_dialogvar(self): |
|
| 158 | url = reverse('sipdialog_dialogvar_list') |
|
| 159 | response = self.client.get(url) |
|
| 160 | self.assertEqual(response.status_code, 200) |
|
| 161 | ||
| 162 | def test_create_dialogvar(self): |
|
| 163 | url = reverse('sipdialog_dialogvar_create') |
|
| 164 | data = { |
|
| 165 | "hash_entry": "hash_entry", |
|
| 166 | "hash_id": "hash_id", |
|
| 167 | "dialog_key": "dialog_key", |
|
| 168 | "dialog_value": "dialog_value", |
|
| 169 | } |
|
| 170 | response = self.client.post(url, data=data) |
|
| 171 | self.assertEqual(response.status_code, 302) |
|
| 172 | ||
| 173 | def test_detail_dialogvar(self): |
|
| 174 | dialogvar = create_dialogvar() |
|
| 175 | url = reverse('sipdialog_dialogvar_detail', args=[dialogvar.pk,]) |
|
| 176 | response = self.client.get(url) |
|
| 177 | self.assertEqual(response.status_code, 200) |
|
| 178 | ||
| 179 | def test_update_dialogvar(self): |
|
| 180 | dialogvar = create_dialogvar() |
|
| 181 | data = { |
|
| 182 | "hash_entry": "hash_entry", |
|
| 183 | "hash_id": "hash_id", |
|
| 184 | "dialog_key": "dialog_key", |
|
| 185 | "dialog_value": "dialog_value", |
|
| 186 | } |
|
| 187 | url = reverse('sipdialog_dialogvar_update', args=[dialogvar.pk,]) |
|
| 188 | response = self.client.post(url, data) |
|
| 189 | self.assertEqual(response.status_code, 302) |
|
| 190 | ||
| 191 | ||
| 192 | ||
| @@ 68-117 (lines=50) @@ | ||
| 65 | return MissedCall.objects.create(**defaults) |
|
| 66 | ||
| 67 | ||
| 68 | class AccViewTest(unittest.TestCase): |
|
| 69 | ''' |
|
| 70 | Tests for Acc |
|
| 71 | ''' |
|
| 72 | def setUp(self): |
|
| 73 | self.client = Client() |
|
| 74 | ||
| 75 | def test_list_acc(self): |
|
| 76 | url = reverse('accounting_acc_list') |
|
| 77 | response = self.client.get(url) |
|
| 78 | self.assertEqual(response.status_code, 200) |
|
| 79 | ||
| 80 | def test_create_acc(self): |
|
| 81 | url = reverse('accounting_acc_create') |
|
| 82 | data = { |
|
| 83 | "method": "method", |
|
| 84 | "from_tag": "from_tag", |
|
| 85 | "to_tag": "to_tag", |
|
| 86 | "callid": "callid", |
|
| 87 | "sip_code": "sip_code", |
|
| 88 | "sip_reason": "sip_reason", |
|
| 89 | "time": "time", |
|
| 90 | "time_attr": "time_attr", |
|
| 91 | "time_exten": "time_exten", |
|
| 92 | } |
|
| 93 | response = self.client.post(url, data=data) |
|
| 94 | self.assertEqual(response.status_code, 302) |
|
| 95 | ||
| 96 | def test_detail_acc(self): |
|
| 97 | acc = create_acc() |
|
| 98 | url = reverse('accounting_acc_detail', args=[acc.pk,]) |
|
| 99 | response = self.client.get(url) |
|
| 100 | self.assertEqual(response.status_code, 200) |
|
| 101 | ||
| 102 | def test_update_acc(self): |
|
| 103 | acc = create_acc() |
|
| 104 | data = { |
|
| 105 | "method": "method", |
|
| 106 | "from_tag": "from_tag", |
|
| 107 | "to_tag": "to_tag", |
|
| 108 | "callid": "callid", |
|
| 109 | "sip_code": "sip_code", |
|
| 110 | "sip_reason": "sip_reason", |
|
| 111 | "time": "time", |
|
| 112 | "time_attr": "time_attr", |
|
| 113 | "time_exten": "time_exten", |
|
| 114 | } |
|
| 115 | url = reverse('accounting_acc_update', args=[acc.pk,]) |
|
| 116 | response = self.client.post(url, data) |
|
| 117 | self.assertEqual(response.status_code, 302) |
|
| 118 | ||
| 119 | ||
| 120 | class AccCdrViewTest(unittest.TestCase): |
|
| @@ 160-205 (lines=46) @@ | ||
| 157 | self.assertEqual(response.status_code, 302) |
|
| 158 | ||
| 159 | ||
| 160 | class MissedCallViewTest(unittest.TestCase): |
|
| 161 | ''' |
|
| 162 | Tests for MissedCall |
|
| 163 | ''' |
|
| 164 | def setUp(self): |
|
| 165 | self.client = Client() |
|
| 166 | ||
| 167 | def test_list_missedcall(self): |
|
| 168 | url = reverse('accounting_missedcall_list') |
|
| 169 | response = self.client.get(url) |
|
| 170 | self.assertEqual(response.status_code, 200) |
|
| 171 | ||
| 172 | def test_create_missedcall(self): |
|
| 173 | url = reverse('accounting_missedcall_create') |
|
| 174 | data = { |
|
| 175 | "method": "method", |
|
| 176 | "from_tag": "from_tag", |
|
| 177 | "to_tag": "to_tag", |
|
| 178 | "callid": "callid", |
|
| 179 | "sip_code": "sip_code", |
|
| 180 | "sip_reason": "sip_reason", |
|
| 181 | "time": "time", |
|
| 182 | } |
|
| 183 | response = self.client.post(url, data=data) |
|
| 184 | self.assertEqual(response.status_code, 302) |
|
| 185 | ||
| 186 | def test_detail_missedcall(self): |
|
| 187 | missedcall = create_missedcall() |
|
| 188 | url = reverse('accounting_missedcall_detail', args=[missedcall.pk,]) |
|
| 189 | response = self.client.get(url) |
|
| 190 | self.assertEqual(response.status_code, 200) |
|
| 191 | ||
| 192 | def test_update_missedcall(self): |
|
| 193 | missedcall = create_missedcall() |
|
| 194 | data = { |
|
| 195 | "method": "method", |
|
| 196 | "from_tag": "from_tag", |
|
| 197 | "to_tag": "to_tag", |
|
| 198 | "callid": "callid", |
|
| 199 | "sip_code": "sip_code", |
|
| 200 | "sip_reason": "sip_reason", |
|
| 201 | "time": "time", |
|
| 202 | } |
|
| 203 | url = reverse('accounting_missedcall_update', args=[missedcall.pk,]) |
|
| 204 | response = self.client.post(url, data) |
|
| 205 | self.assertEqual(response.status_code, 302) |
|
| 206 | ||
| @@ 120-157 (lines=38) @@ | ||
| 117 | self.assertEqual(response.status_code, 302) |
|
| 118 | ||
| 119 | ||
| 120 | class AccCdrViewTest(unittest.TestCase): |
|
| 121 | ''' |
|
| 122 | Tests for AccCdr |
|
| 123 | ''' |
|
| 124 | def setUp(self): |
|
| 125 | self.client = Client() |
|
| 126 | ||
| 127 | def test_list_acccdr(self): |
|
| 128 | url = reverse('accounting_acccdr_list') |
|
| 129 | response = self.client.get(url) |
|
| 130 | self.assertEqual(response.status_code, 200) |
|
| 131 | ||
| 132 | def test_create_acccdr(self): |
|
| 133 | url = reverse('accounting_acccdr_create') |
|
| 134 | data = { |
|
| 135 | "start_time": "start_time", |
|
| 136 | "end_time": "end_time", |
|
| 137 | "duration": "duration", |
|
| 138 | } |
|
| 139 | response = self.client.post(url, data=data) |
|
| 140 | self.assertEqual(response.status_code, 302) |
|
| 141 | ||
| 142 | def test_detail_acccdr(self): |
|
| 143 | acccdr = create_acccdr() |
|
| 144 | url = reverse('accounting_acccdr_detail', args=[acccdr.pk,]) |
|
| 145 | response = self.client.get(url) |
|
| 146 | self.assertEqual(response.status_code, 200) |
|
| 147 | ||
| 148 | def test_update_acccdr(self): |
|
| 149 | acccdr = create_acccdr() |
|
| 150 | data = { |
|
| 151 | "start_time": "start_time", |
|
| 152 | "end_time": "end_time", |
|
| 153 | "duration": "duration", |
|
| 154 | } |
|
| 155 | url = reverse('accounting_acccdr_update', args=[acccdr.pk,]) |
|
| 156 | response = self.client.post(url, data) |
|
| 157 | self.assertEqual(response.status_code, 302) |
|
| 158 | ||
| 159 | ||
| 160 | class MissedCallViewTest(unittest.TestCase): |
|