blob: 5ec8ca8ea0a582ff919ae75fe978995c2e685658 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
package com.tylerstonge.honeypot.ftp
import akka.actor.{ActorSystem, Props}
import akka.io.Tcp.{Received, Write}
import akka.testkit.{ImplicitSender, TestKit}
import akka.util.ByteString
import org.scalatest.BeforeAndAfterAll
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpecLike
/**
*
* @author Tyler St. Onge <tylertstonge@gmail.com>
*/
class FtpHandlerTest extends TestKit(ActorSystem("honeypot-system")) with ImplicitSender with AnyWordSpecLike with Matchers with BeforeAndAfterAll {
override def afterAll: Unit = {
TestKit.shutdownActorSystem(system)
}
// "An FtpHandler actor" must {
// "return 331 in response to USER" in {
// val handler = system.actorOf(Props[FtpHandler])
// handler ! Received(ByteString("USER anonymous"))
// val msg = expectMsgType[Write]
// assert(msg.data.utf8String.startsWith("331"))
// }
// "return 230 in response to PASS" in {
// val handler = system.actorOf(Props[FtpHandler])
// handler ! Received(ByteString("PASS password"))
// val msg = expectMsgType[Write]
// assert(msg.data.utf8String.startsWith("230"))
// }
// "return 257 in response to PWD" in {
// val handler = system.actorOf(Props[FtpHandler])
// handler ! Received(ByteString("PWD"))
// val msg = expectMsgType[Write]
// assert(msg.data.utf8String.startsWith("257"))
// }
// "return 221 in response to QUIT" in {
// val handler = system.actorOf(Props[FtpHandler])
// handler ! Received(ByteString("quit"))
// val msg = expectMsgType[Write]
// assert(msg.data.utf8String.startsWith("221"))
// }
// }
}
|